package com.hkyp.ss.course.provider.model;


import com.hkyp.ss.course.provider.model.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

/**
 * 评论表
 *
 *  包含：
 *      一级评论
 *
 *
 */
@Data
@Entity
@Table(
        indexes = {
                @Index(columnList = "status",name = "statusIndex"),

        }
)
@DynamicUpdate
@DynamicInsert
@EqualsAndHashCode(callSuper=true)
public class Comment extends BaseEntity {

    /**
     * 课评id
     * courseCommentId
     */
    private Long CCId;

    /**
     * 用户id
     * 评论的发起者
     */
    private Long userId;


    /**
     * 评论内容
     *
     * 限制长度最长500字
     */
    @Column(name = "content",length = 600,columnDefinition = "text")
    private String content;


    /**
     * 踩数
     */
    private Integer userDislike = 0;

    /**
     * 点赞数
     */
    private Integer userLike = 0;

    /**
     * 课评数
     * 评论人数      comment
     */
    private Integer commentNum = 0;


    /**
     * 课评状态
     * 默认值为1
     * 0：正常；1：删除
     */
    @Column(name = "status", columnDefinition = "tinyint")
    private Integer status = 0;

}
